import pymongo

Mongo_Url = 'localhost'
Mongo_DB = 'Lianjia'
Mongo_TABLE_ErShouFang = 'ershoufang'
Mongo_TABLE_XiaoQu = 'xiaoqu'
client = pymongo.MongoClient(Mongo_Url)
db = client[Mongo_DB]

datas = db[Mongo_TABLE_ErShouFang].aggregate(
    [
        {"$match": {"小区编号": "1111027374840"}},
        {"$limit": 2},
        {"$lookup": {"localField": "小区编号", "from": "xiaoqu", 'foreignField': '小区编号', "as": "xiaoqu_info"}},

    ])

for d in datas:
    print(d)
